﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using QuanLyShop.BUS;
using QuanLyShop.DTO;

namespace SHOP
{
    public partial class TL_GiaBan : Form
    {
        public TL_GiaBan()
        {
            InitializeComponent();
        }
        GiaBanDTO gia = new GiaBanDTO();
        private void thêmGiáMớiToolStripMenuItem_Click(object sender, EventArgs e)
        {
            TL_GiaBan_ThemGiaMoi frmThemGiaBanMoi = new TL_GiaBan_ThemGiaMoi();
            frmThemGiaBanMoi.Show();
        }

        private void sửaGiáNàyToolStripMenuItem_Click(object sender, EventArgs e)
        {
            gia.ID_GiaBan = dgv_DanhSachGiaBan.SelectedRows[0].Cells["STT"].Value.ToString();
            gia.ID_MatHang = dgv_DanhSachGiaBan.SelectedRows[0].Cells["ID_MatHang"].Value.ToString();
            gia.TenGiaBan = dgv_DanhSachGiaBan.SelectedRows[0].Cells["TenGiaBan"].Value.ToString();
            gia.Kieu = dgv_DanhSachGiaBan.SelectedRows[0].Cells["Kieu"].Value.ToString(); ;
            gia.GiaTri = dgv_DanhSachGiaBan.SelectedRows[0].Cells["GiaTri"].Value.ToString(); ;
            gia.ThongTinThem = dgv_DanhSachGiaBan.SelectedRows[0].Cells["ThongTinThem"].Value.ToString();
            gia.TinhTrang = int.Parse(dgv_DanhSachGiaBan.SelectedRows[0].Cells["TinhTrang"].Value.ToString());
            TL_GiaBan_SuaGia frmSuaGia = new TL_GiaBan_SuaGia();
            frmSuaGia.SuaGia(gia);
            frmSuaGia.Show();
        }

        private void TL_GiaBan_Load(object sender, EventArgs e)
        {
            GiaBanBUS BUS = new GiaBanBUS();
            DataTable dt = new DataTable();
            dt = BUS.LayDanhSachGiaBan();
            dgv_DanhSachGiaBan.DataSource = dt;
        }

        private void btnDong_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}
